<!DOCTYPE html>
<html>
<head>
  {include file="top.tpl"}
  <link rel="stylesheet" href="{$css.url}purchasing_require.css">
</head>
<body class="skin-blue">
<div class="wrapper">
	{include file="bread_crumbs.tpl"}
  	<!-- main start-->
  	<section class="detection-wrap">
		<div class="row">
			<div class="col-md-12">
				<div class="box">
					<div class="nav-tabs-custom">
						<ul class="nav nav-tabs">
					      <li class="active"><a href="/backup/log/a-story">需求A检测</a></li>
					      <li><a href="/backup/log/c-story">需求c检测</a></li>					      
					    </ul>
				    </div>
				    <div class="box-header with-border clearfix">
				    	<div class="row">
				    		<div class="col-sm-12">
				    			<div class="box-form pull-right form-group-sm">
			                		<p class="pull-right"><a href="javascript:;" class="btn btn-success btn-sm" id="js_toggleSearchBox"><i class="fa fa-search"></i><span class="pl5">搜索选项</span></a></p>
			                	</div>
				    		</div>
				    	</div>
				    	<div class="search-box" id="js_searchBox">
			    			<form action="/backup/log/a-story" method="get" class="form-inline auto-restore">
				    			<div class="form-group">
					    			<label class="control-label">产品编码<span class="c_red">*</span> :</label>
					    			<input type="text" class="form-control" name="goods_sn">
					    		</div>
					    		<div class="form-group">
					    			<label class="control-label">所属事业部<span class="c_red">*</span> :</label>
									<select class="form-control" name="dept_id" id="dept_id">
					    				<option value="">选择事业部</option>
                                         {foreach from=$hasWarehouseDep item=oneDep}
                                           <option value="{$oneDep['id']}">{$oneDep['department_name']}</option>
                                         {/foreach}
					    			</select>
					    		</div>
					    		<div class="form-group">
					    			<select name="warehouse" class="form-control" id="dep_warehouse" name="warehouse" style="width:200px;">
					    				<option value="">选择仓库</option>
					    			</select>
								</div>
								<div class="form-group">
								   <label class="control-label">日期 :</label>
								    <input type="text" class="form-control js_datePicker date_start" name="date" value="" placeholder="开始时间">
								</div>
								<div class="form-group">
					            	<input type="submit" id="search_button" class="btn btn-primary btn-sm" value="查询并检测">
								</div>
								<span class="pull-right"><a href="javascript:;">采购需求答疑文档下载</a></span>
							</form>
				    	</div>
				    </div>
				    <div class="box-body">
				    	<div class="row">
				    		<div class="col-sm-6">
				    			<div class="well">
				    				{if $productAStoryLog && $productAStoryLog['has_calculate_a_story']}
				    			    <div>
				    				<p><span>产品名称：</span>{$productAStoryLog['product_name']} </p>
				    				<p><span>产品图片：</span><img src="{$productAStoryLog['thumb_url']}" alt=""></p>
				    		
				    				<div class='log_detail'>
				    				<p><span>需求A数量：</span>{$productAStoryLog['a_story_quantity']}</p>
				    				<p>
				    					<span>检测过程如下：</span>
				    					<ul class="list-group">
										  <li class="list-group-item">产品等级：{$productAStoryLog['productGradeName']} 
										  {if $productAStoryLog['productGradeCheckFail']}
										    <em class="glyphicon glyphicon-remove pull-right"></em>
										  {else}
										    <em class="glyphicon glyphicon-ok pull-right"></em>
										  {/if}
										  </li>
										  <li class="list-group-item">产品分类：{$productAStoryLog['productCatalogName']} 
										  	 {if !$productAStoryLog['productCatalogCheckFail']}
										        <em class="glyphicon glyphicon-ok pull-right"></em>
										     {else}
										        <em class="glyphicon glyphicon-remove pull-right"></em>
										     {/if}
									
										  </li>
										  <li class="list-group-item">货源状态：{$productAStoryLog['productResourceStatusName']}
										 	 {if !$productAStoryLog['productResourceStatusCheckFail']}
										        <em class="glyphicon glyphicon-ok pull-right"></em>
										     {else}
										        <em class="glyphicon glyphicon-remove pull-right"></em>
										     {/if}
										  </li>
										  <li class="list-group-item">是否被拦截：
  	                                         {if !$productAStoryLog['a_story_is_intercept']}
									           否<em class="glyphicon glyphicon-ok pull-right"></em>
									         {else}
									           是<em class="glyphicon glyphicon-remove pull-right"></em>
									         {/if}
										</ul>
				    				</p>
				    				<p><span>检测结果：</span>
				    				{if $productAStoryLog['notHaveAStoryReason']}
				    				   {$productAStoryLog['notHaveAStoryReason']}
				    				{else}
				    				  产品{$productAStoryLog['goods_sn']}的产品状态正常，满足产生需求A的要求
				    				{/if}
				    				</p>
				    				</div>
				    				</div>
                                   {/if}
                                   <p>未找到该产品在选择仓库的A需求！</p>
				    			</div>
				    		</div>
				    		<div class="col-sm-6">
				    			<div class="well">
				    				<dl>
				    					<dt class="mb10">需求A计算规则说明</dt>
				    					<dd>1、参与需求A计算的规则</dd>
				    					包含以下标识的sku不参与需求A的计算：
										产品等级为：违禁品、清仓产品、停滞；
										产品分类为：清仓清库存专区、侵权产品、海关限制类产品、停滞产品类；
										货源状态：停产；
										清仓状态：清仓标识（sku+仓库）。
				    				</dl>
				    			</div>
				    		</div>
				    	</div>
				    </div>
				</div>
			</div>
		</div>
	</section>
  	<!-- main end-->

 </div>
{include file='foot.tpl'}
 <script type="text/javascript">
 {literal}
$('#dept_id').change(dept);
function dept(did){
	var did = !isNaN(did) ? did : $(this).find('option:selected').val();
	var str = '<option value="0">选择仓库</option>';
	var select_warehouse=GLOBAL.getUrlParam('warehouse');
	$.ajax({
		url : '/base/warehouse/getselectedwarehousebydeptid',
		data : {did : did},
		dataType : 'json',
		type : 'get',
		success : function (result){
			$.each(result, function(i, n){
				if(select_warehouse && select_warehouse==n.warehouse_code){
                		str += '<option value="' + n.warehouse_code + '" selected>' + n.warehouse_name + '</option>' + "\r\n";
                	}else{
                		str += '<option value="' + n.warehouse_code + '">' + n.warehouse_name + '</option>' + "\r\n";
                }
			});
			$('#dep_warehouse').html(str);
			$("#dep_warehouse").select2();
		}
	});
}

$(function(){
    $('.date_start').datetimepicker({
	    format: "yyyy-mm-dd",
        minView:2,
        autoclose: true,
        todayHighlight: false
	});
})
{/literal}
dept(GLOBAL.getUrlParam('dept_id'));
</script>
<script src="{$js.url}form_helper.js"></script>
</body>
</html>